#include "../../../dxhead/dxegheader.h"
#include "../inc/xResManager.h"
#include "../../framework/framework.h"
#include "../../tools/inc/xResCreator.h"
namespace NTools
{
	using namespace NLib;
	using namespace NTrace;
TResult xResManager::CreateRes( TChar* type,xRes** res,TChar* name,TInt flag)
{
	xIApp* app = NLib::xGlobal<xIApp*>::get();
	if(app == VNull)
	{
		myTrace0(eLevel_Middle,"NLib::xGlobal<xApp*>::Get() == VNull");
		return XE_ARGUMENT;
	} // if(app == VNull)
	xDevice* dev = app->getDevice();

	tInfo* info;
	nreturn_hr_M(info, xFactory<tInfo>::Create(),XE_NOMEMORY);
	xRes* temp = VNull;
	//switch(type)
	//{
	//	/*case xRes::eType_Res:
	//		myTrace0(eLevel_Infor,"Invalid argument: eType_Res");
	//		return XE_ARGUMENT;
	//		break;
	//	case xRes::eType_Pict:
	//		vreturn_my_M(xResCreator::CreatePict(dev,name,flag,&temp));
	//		break;
	//	case xRes::eType_Sprite:
	//		vreturn_my_M(xResCreator::CreateSprite(dev,name,flag,&temp));
	//		break;
	//	default:
	//		myTrace0(eLevel_Infor,"Invalid argument!");
	//		return XE_ARGUMENT;
	//		break;*/

	//} // switch(type)

	if(temp == VNull)
	{
		xFactory<tInfo>::Delete(info);
	}
	return XE_ARGUMENT;
}
}